package com.app.shortvideo.utils.jump

import android.app.Activity
import android.content.Context
import android.net.Uri
import com.app.shortvideo.utils.jump.IJumper
import com.app.shortvideo.utils.jump.MaxityHosts

abstract class BaseJumper(protected var action: String?) : IJumper {

    protected var mUri: Uri = Uri.parse(action ?: "")

    init {
    }

   protected abstract val host: String

    override fun isSupport(): Boolean {
        return isMaxScheme && host == mUri.host
    }

    override fun checkShouldJump(context: Context?): Boolean {
        return true
    }

    override fun onJumpInterrupted(activity: Activity?) {
        //do nothing
    }

    protected val isHttpScheme: Boolean
        protected get() = MaxityHosts.HTTP_SCHEME == mUri!!.scheme || MaxityHosts.HTTPS_SCHEME == mUri!!.scheme

    protected val isMaxScheme: Boolean
        protected get() = MaxityHosts.MAXITY_SCHEME == mUri!!.scheme

}